package com.zjp;

import cn.hutool.json.JSONUtil;
import com.zjp.domain.Person;
import com.zjp.domain.ValueObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Hello world!
 */
public class App {
    public static void main(String[] args) {
        List<ValueObject> list = new ArrayList<>();
        ValueObject v1 = new ValueObject();
        v1.setFieldName("name");
        v1.setFieldValue("张三");
        v1.setFieldType("String");
        list.add(v1);

        ValueObject v2 = new ValueObject();
        v2.setFieldName("age");
        v2.setFieldValue("28");
        v2.setFieldType("Integer");
        list.add(v2);
        String jsonStr = JSONUtil.toJsonStr(list);
        System.out.println(jsonStr);

        Person p1 = new Person();
        p1.setName("张三");
        p1.setAge("28");
        System.out.println(JSONUtil.toJsonStr(p1));
    }
}
